package be.dch.util;

import org.easymock.IArgumentMatcher;

public class StringBuilderMatcher implements IArgumentMatcher {

    private String value;

    public StringBuilderMatcher(String value) {
	this.value = value;
    }

    public void appendTo(StringBuffer arg0) {
	arg0.append(value);
    }

    public boolean matches(Object arg0) {
	if (!(arg0 instanceof StringBuilder)) {
	    throw new IllegalArgumentException("arg0 is not java.lang.StringBuilder. [" + arg0.getClass() + "]");
	}
	String result = ((StringBuilder) arg0).toString();
	return result.equals(value);
    }

}
